/*
Compile the program in Listing 6-1 ( mem_segments.c ), and list its size using ls –l.
Although the program contains an array (mbuf) that is around 10 MB in size, the
executable file is much smaller than this. Why is this?
 */

#include <stdio.h>
#include <stdlib.h>

char globBug[65536];
int primes[] = {2, 3, 5, 7};

static int
square(int x)
{
  int result;

  result = x * x;
  return result;
}

static void
doCalc(int val)
{
  printf("The square of %d is %d\n", val, square(val));

  if (val < 1000)
    {
      int t;
      t = val * val * val;
      printf("The cube of %d is %d\n", val, t);
    }
}

int
main(int argc, char *argv[])
{
  static int key = 9973;
  static char mbuf[10240000];
  // initialized in runtime placed in bss block to take less space on disk
  // bss = block started by symbol
  char *p;
  p = malloc(1024);
  doCalc(key);
  return EXIT_SUCCESS;
}
